package com.xcapp.xcshop.controller;

import com.xcapp.xcshop.model.Person;
import com.xcapp.xcshop.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin(origins = "*") // 表示该类方法允许跨域
@RestController
public class PersonController {

    @Autowired  // 这里拿到处理完业务逻辑的PersonService的数据
    private PersonService personService;

    /**
     * 获取所有用户信息
     * @return List
     */
    @RequestMapping("getPerson")
    public List<Person> getPerson(){
        return personService.findAll();
    }
}